package com.example.stmall.manager.controller;

import com.example.stmall.manager.util.VerCodeUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/vercode")
public class VercodeController {
    @GetMapping
    public void vercode(HttpServletResponse response, HttpSession session){
        //随机生成字符串，绘制一张图片
        //将图片交给Response对象
        String vercode = VerCodeUtil.createVerCode(response);
        session.setAttribute("vercode",vercode);
    }
}
